const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');

const app = express();
app.use(cors())
app.use(express.urlencoded({extended: false}))
app.use(bodyParser.json())

// 静态文件托管
app.use(express.static('uploads'))

const userRouter = require('./router/user')
app.use('/api/user', userRouter)

const goodsRouter = require('./router/goods')
app.use('/api/goods', goodsRouter)

app.listen(3011, () => {
    console.log('api server running at http://127.0.0.1:3011')
})